package com.hpu.parser;

import com.hpu.bean.Version;

import org.json.JSONObject;

public class VersionParser{

	public Version parse(String parseString) {
		try {
			JSONObject object=new JSONObject(parseString);
			String version=object.getString("app_first_id");
			int versionNumber=Integer.parseInt(object.getString("app_second_id"));
			String info=object.getString("version_description");
			String time=object.getString("upload_time");
			String path=object.getString("file_path");
			return new Version(version, versionNumber, info, path, time);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
